package com.swf.common.fmt;

import java.io.*;

import org.dom4j.*;

import com.swf.common.xml.*;



public class ReceiveFmt {
	private String id;
	private String content;
	private XmlHead xmlHead; 
	private XmlWrap xmlWrap;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public XmlHead getXmlHead() {
		return xmlHead;
	}
	public void setXmlHead(XmlHead xmlHead) {
		this.xmlHead = xmlHead;
	}
	public XmlWrap getXmlWrap() {
		return xmlWrap;
	}
	public void setXmlWrap(XmlWrap xmlWrap) {
		this.xmlWrap = xmlWrap;
	}
	
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("<fmtDef id=\""+id+"ReceiveFormat\">");
		sb.append("<xmlWrap>");
		sb.append(this.xmlHead.toString());
		sb.append(this.xmlWrap.toString());
		sb.append("</xmlWrap>");
		sb.append("</fmtDef>");
		return sb.toString();
	}
	
	
	public String toFormatString() {
		try {
			return FwsXmlUtils.formatPrettyXmlWithOutEncoding(toString());
		} catch (DocumentException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
}